Re: [SQL] Doubts in timespan - Mailing list pgsql-sql

From Herouth Maoz
Subject Re: [SQL] Doubts in timespan
Date
Msg-id l03130302b3f04f90bc5e@[147.233.159.109]
Whole thread Raw
In response to Doubts in timespan  (Paulo Roberto Kappke <paulok@cyclades.com.br>)
List pgsql-sql
At 16:23 +0300 on 26/08/1999, Paulo Roberto Kappke wrote:


> "UPDATE tasktime SET elapsed_time='age((SELECT inserted_time FROM
> tasktime WHERE row=$row),(SELECT inserted_time FROM tasktime WHERE
> row=$old_row))' WHERE row=$old_row"

If I'm not mistaken, Postgres does not allow subselects to be used in this
context. In any case the age function should not be in quotes...

Instead, the syntax Postgres uses from the days of old would be something like

UPDATE tasktime
SET elapsed_time = age( tt.inserted_time, inserted_time )
FROM tasktime tt
WHERE row=$old_row AND tt.row = $row;

This has nothing to do with timespan.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma




pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] problem with select
Next
From: "tjk@tksoft.com"
Date:
Subject: Re: [SQL] problem with select